package org.holynite.fieldmanage.entities

import org.holynite.fieldmanage.types.CashierOperateType

import javax.persistence.*

/**
 * Created by midnite on 15/1/5.
 */
@Entity
@Table(name = "cashier_record_detail")
class CashierRecordDetail implements Serializable {
	@Id
	@Column(name = "serial", nullable = false)
	String serial
	@Column(name = "record_serial", nullable = false)
	String recordSerial
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "operate_time", nullable = false)
	Date operateTime
	@Column(name = "content", nullable = false)
	String content
	@Enumerated(EnumType.STRING)
	@Column(name = "type", nullable = false)
	CashierOperateType operateType
	@Column(name = "amount", nullable = false)
	Float amount = 0
	@Column(name = "balance", nullable = false)
	Float balance = 0

	boolean equals(o) {
		if (this.is(o)) return true
		if (getClass() != o.class) return false

		CashierRecordDetail that = (CashierRecordDetail) o

		if (serial != that.serial) return false

		return true
	}

	int hashCode() {
		return (serial != null ? serial.hashCode() : 0)
	}
}
